package org.example.system.controller.user;

import org.example.common.core.controller.BaseController;
import org.example.common.core.domain.Result;
import org.example.common.core.domain.ResultTable;
import org.example.system.domain.user.dto.UserQueryDTO;
import org.example.system.domain.user.dto.UserUpdateStatusDTO;
import org.example.system.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    public ResultTable list(UserQueryDTO userQueryDTO) {
        return getTable(userService.list(userQueryDTO));
    }

    @PutMapping("/updateStatus")
    // todo 拉黑，限制用户操作  解禁，放开用户限制
    public Result<Void> updateStatus(@RequestBody UserUpdateStatusDTO userUpdateStatusDTO) {
        return toResult(userService.updateStatus(userUpdateStatusDTO));
    }

}
